<?php

namespace App\Http\Controllers\Api;
use App\Models\Config;
use App\Models\System;
use App\Models\Version;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Cloud;
use Exception;
use DB;

/**
 * Class ConfigController
 * @package App\Http\Controllers\Api1111
 */
class ConfigController extends Controller
{
    /**
     * 关于我们
     *
     * @ author: zrc
     * @ E-mail:904725327@qq.com
     * @ date: 2018/5/19
     * @access public|private|protected
     * @param  mixed    name    comment
     * @param  int    name    comment
     * @param  string    name    comment
     * @param  bool       name    comment
     * @param  array   name    comment
     * @return void|int|string|boolean|array        comment
     */
    public function about_app()
    {
        //名称
        $list['name'] = 'BAP';
        $list['logo'] = '-';
        $name = System::first();
        if ($name){
            $list['name'] = $name->app_name;
            $list['logo'] = config('alioss.host') . '/' . $name->app_logo;
        }
        //版本号
        $versions = Version::first();
        $list['versions'] = $versions->version;
        $list['oss_path'] = $versions->oss_path;
        $list['is_force'] = $versions->is_force;
        return response()->json(['status' => 1, 'msg' => '查询成功','data'=>$list]);
    }

    /**
     * 联系我们
     *
     * @ author: zrc
     * @ E-mail:904725327@qq.com
     * @ date: 2018/5/19
     * @access public|private|protected
     * @param  mixed    name    comment
     * @param  int    name    comment
     * @param  string    name    comment
     * @param  bool       name    comment
     * @param  array   name    comment
     * @return void|int|string|boolean|array        comment
     */
    public function about_us()
    {
        $list['tel'] = '-';
        $list['qq'] = '-';
        $tel = System::first();
        if ($tel){
            $list['tel'] = $tel->tel;
            $list['qq'] = $tel->qq;
        }
        return response()->json(['status' => 1, 'msg' => '查询成功','data'=>$list]);
    }
    /**
     * 服务条款
     *
     * @ author: zrc
     * @ E-mail:904725327@qq.com
     * @ date: 2018/5/19
     * @access public|private|protected
     * @param  mixed    name    comment
     * @param  int    name    comment
     * @param  string    name    comment
     * @param  bool       name    comment
     * @param  array   name    comment
     * @return void|int|string|boolean|array        comment
     */
    public function about_clause()
    {
        $list['clause'] = '-';
        $clause = Config::where(['key' => 'clause'])->first();
        if ($clause)
            $list['clause'] = $clause->value;
        return view('api/config/about_clause', compact('list'));

    }
}
